package restful.struts2.app1;

import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;

import org.junit.*;

import restful.struts2.*;

public class StatusIT extends ProtocolIT {

	@BeforeClass
	public static void setUpClass() throws Exception {
		start("app1");
	}

	@Test
	public void testEchoProtocolIsDefined() throws Exception {
		GET("/protocol.txt");
		assertThat(content, containsString("POST /status/{code}"));
	}

	@Test
	public void testPostSatus200() throws Exception {
		POST("/status/200.json");
		assertThat(status, is(equalTo(200)));
	}

	@Test
	public void testPostSatus201() throws Exception {
		POST("/status/201.json");
		assertThat(status, is(equalTo(201)));
	}

	@Test
	public void testPostSatus204() throws Exception {
		POST("/status/204.json");
		assertThat(status, is(equalTo(204)));
	}

	@Test
	public void testPostSatus302() throws Exception {
		POST("/status/302.json");
		assertThat(status, is(equalTo(302)));
	}
	
	@Test
	public void testPostSatus500() throws Exception {
		POST("/status/500.json");
		assertThat(status, is(equalTo(500)));
	}
}
